package com.mhz.cae.events;

import android.util.SparseIntArray;

public class Event {

	public enum EventType {
		LAUNCH_EVENT, RESET_EVENT, SELECT_ITEM_EVENT, ADD_ITEM_EVENT, OPEN_INVENTORY_EVENT
	}

	private final EventType mType;

	private SparseIntArray mEventData = null;

	public Event(EventType type) {
		mType = type;
	}

	public Event(EventType type, int nbParameters) {
		mType = type;
		if (nbParameters != 0) {
			mEventData = new SparseIntArray(nbParameters);
		}
	}

	public EventType getType() {
		return mType;
	}

	public void addParameter(int key, int value) {
		if (mEventData != null) {
			mEventData.put(key, value);
		}
	}

	public int getParameter(int key) {
		if (mEventData != null) {
			return mEventData.get(key);
		}
		return -1;
	}

	@Override
	public String toString() {
		return new StringBuffer("Event type = ").append(mType).toString();
	}

}
